package com.zsrt.day20170506.synproxy;

import org.junit.Test;

/**
*@author jzh
*@创建时间 2017年5月6日下午6:38:09
*类说明：
*/
public class SyncProxyTest {
	
	@Test
	public void studentAddTest(){
		StudentsService ss=new StudentsServiceImpl();
		SyncProxy sp=new SyncProxy(ss);
		
		Object object = sp.getInstance();
		StudentsService proxyObj=(StudentsService)object;
		proxyObj.add();
	}
	
	
	@Test
	public void studentStudyTest(){
		StudentsService ss=new StudentsServiceImpl();
		SyncProxy sp=new SyncProxy(ss);
		//创建一个代理对象
		Object object = sp.getInstance();
		//强转成本来的      接口	对象,不能是实现类的对象
		StudentsService proxyObj=(StudentsService)object;
		proxyObj.study();
	}

}
